<template>
	<view class="page">
		<block v-for="(item,index) in myInfoList" :key="item.ID">
			<view class="job-position-item" @click="gotoJobContent(item.ID, item.ZPType)">
				<view class="job-position-head">
					<view class="job-position-head-title">
						<view class="job-position-head-state-top" v-if="item.IsTop == 1">顶</view>
						<view class="job-position-head-state-part" v-if="item.ZPType == 2">兼职</view>
						<view class="job-position-head-text">{{  item.ZWName }}</view>
						<view class="job-position-head-real" v-if="item.JobRZType == 1">
							<image src="../../static/job/qy.png" style="width: 32rpx; height: 32rpx;" class="job-position-head-real-image" mode="aspectFit"></image>
						</view>
					</view>
					
					<view class="job-position-head-salary">
						{{ item.XZName }}
					</view>
				</view>
				<view class="job-position-body">
					<view class="job-position-body-text"> 招聘人数：{{ item.ZPNum }}人 | {{ item.DiYu }} </view>
					<view class="job-position-body-time">{{ setTimeTxt(item.ShiJian)}}</view>
				</view>
				<view class="job-position-center">
					<view class="job-position-tag">
						<view class="job-position-bottom-type">
							公司
						</view>
						<view class="job-position-bottom-company">
							{{ item.Company}}
						</view>
						<!-- <view class="job-position-tag-item" v-for="(tagItem, tagIndex)  in item.FuLiList" :key="tagIndex">
							<u-tag :text="tagItem.FuLi" bgColor="#f7d9da" color="#c8000a" size="minimal" type="warning"></u-tag>
						</view> -->
					</view>
					<view class="job-position-tag-action" v-if="item.IsSQ == 0">申请</view>
					<view class="job-position-tag-already" v-else-if="item.IsSQ == 1">已申请</view>
					<view class="job-position-tag-action-timeout" v-else>已过期</view>
				</view>
				<!-- <view class="job-position-bottom">
					<view class="job-position-bottom-type">
						公司
					</view>
					<view class="job-position-bottom-company">
						{{ item.Company}}
					</view>
				</view> -->
			</view>
			<u-gap height="5" bgColor="#f5f5f5" marginTop="10rpx" marginBottom="20rpx"></u-gap>
		</block>
	</view>
</template>

<script>
	import {getDateDiff , getFormatTime} from '../../common/common.js'
	export default {
		name:"PartTimeJobs",
		data() {
			return {
				myInfoList:[], // 接收的列表
			};
		},
		props: {
			jobsList: {
				type: Array,
				default() {
					return [];
				}
			},
		},
		methods: {
			setTimeTxt(time){
				return getDateDiff(parseInt(time)*1000) 
			},
			// setTimeTxt(time){
			// 	return getDateDiff(parseInt(time)*1000) + ' ' +  getFormatTime(parseInt(time), 'Y-M-D h:m:s')
			// },
			gotoJobContent(id, type){
				// console.log(id)
				uni.$u.route({
					url:'pages/jobContent/jobContent',
					params: {
						id: id,
						jobType: type,
					}
				})
			},
		},
		watch: {
			jobsList: function(newVal, oldVal) {
				this.myInfoList = newVal;
				console.log(this.myInfoList)
			}
			
		}
	}
</script>

<style lang="scss" scoped>
/* --------热门职业开始------------------------------------------ */
.job-position-list {
	display: flex;
	flex-direction: column;
}
.job-position-item {
	width: 97%;
	margin-left: auto;
	margin-right: auto;
	display: flex;
	flex-direction: column;
	padding: 20rpx 10rpx;
}
.job-position-head {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	padding: 10rpx 0;
}
.job-position-head-title {
	display: flex;
	flex-direction: row;
	align-items: center;
}
.job-position-head-state-top {
	width: 32rpx;
	height: 32rpx;
	font-size: 24rpx;
	color: #fff;
	line-height: 32rpx;
	text-align: center;
/* 	padding: 0 4rpx; */
	margin-right: 10rpx;
	background-color: #c8000a;
	border-radius: 3rpx;
	overflow: hidden;
}
.job-position-head-state-part {
	width: 56rpx;
	height: 32rpx;
	font-size: 24rpx;
	color: #fff;
	line-height: 32rpx;
	text-align: center;
	/* padding: 0 4rpx; */
	margin-right: 10rpx;
	background-color: #e69800;
	border-radius: 3rpx;
	overflow: hidden;
}
.job-position-head-text {
	width: 430rpx;
	font-size: 30rpx;
	color: #000;
	line-height: 36rpx;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}
.job-position-head-salary {
	width: auto;
	height: 36rpx;
	line-height: 36rpx;
	font-size: 30rpx;
	text-align: right;
	color: #c8000a;
}
.job-position-body {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	padding: 10rpx 0;
}
.job-position-body-text {
	height: 26rpx;
	font-size: 24rpx;
	color: #999999;
	line-height: 26rpx;
}
.job-position-body-time {
    font-size: 24rpx;
    color: #999999;
    line-height: 24rpx;	
}
.job-position-center {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	padding: 10rpx 0;
}
.job-position-tag {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	
}
.job-position-tag-item {
	// padding-right: 10rpx;
	padding: 5rpx 10rpx 5rpx 0rpx;
}
.job-position-tag-item /deep/ .u-tag {
	height: 28rpx;
	line-height: 28rpx;
}
.job-position-tag-action {
	width: 100rpx;
	height: 40rpx;
	text-align: center;
	line-height: 40rpx;
	font-size: 26rpx;
	color: #fff;
	background-color: #c8000a;
	border-radius: 10rpx;
	display: flex;
	flex-direction: row;
	justify-content: center;
	flex-shrink: 0;
}
.job-position-tag-already {
	width: 100rpx;
	height: 40rpx;
	text-align: center;
	line-height: 40rpx;
	font-size: 26rpx;
	color: #fff;
	background-color: #999999;
	border-radius: 10rpx;
	display: flex;
	flex-direction: row;
	justify-content: center;
	flex-shrink: 0;
}
.job-position-tag-action-timeout {
	width: 100rpx;
	height: 40rpx;
	text-align: center;
	line-height: 40rpx;
	font-size: 26rpx;
	color: #fff;
	background-color: #999999;
	border-radius: 10rpx;
	display: flex;
	flex-direction: row;
	justify-content: center;
	flex-shrink: 0;
}
.job-position-bottom {
	display: flex;
	flex-direction: row;
	align-items: center;
	padding: 10rpx 0;
}
.job-position-bottom-type {
	width: 60rpx;
	height: 30rpx;
	font-size: 24rpx;
	color: #c8000a;
	line-height: 30rpx;
	text-align: center;
	border: 1px solid #c8000a;
	box-sizing: border-box;
	margin-right: 10rpx;
}
.job-position-bottom-company {
	font-size: 24rpx;
	color: #999999;
	line-height: 30rpx;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}
/* 热门职业结束 */
</style>
